package com.logos.controller;

import com.logos.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class RestfulUserController {

    @PostMapping("/users")
    @ResponseBody
    public String save(@RequestBody User user) {
        System.out.println("user save..." +user);
        return "{'user':'save'}";
    }

    @DeleteMapping("/users/{id}")
    @ResponseBody
    public String delete(@PathVariable Integer id) {
        System.out.println("user delete..." + id);
        return "{'user':'delete'}";
    }

    @PutMapping("/users")
    @ResponseBody
    public String update(@RequestBody User user) {
        System.out.println("user update..." + user);
        return "{'user':'update'}";
    }

    @GetMapping("/users/{id}")
    @ResponseBody
    public String getById(@PathVariable Integer id) {
        System.out.println("user getById..." + id);
        return "{'user':'getById'}";
    }

    @GetMapping("/users")
    @ResponseBody
    public String getAll() {
        System.out.println("user getAll...");
        return "{'user':'getAll'}";
    }
}
